@extends('admin._layouts.default')

<script language="javascript" type="text/javascript" src="{{ URL::asset('ueditor/ueditor.config.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ueditor/ueditor.config.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ueditor/ueditor.all.min.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ueditor/lang/zh-cn/zh-cn.js') }}"></script>
@section('main')

      <div class="row-fluid ">
        <div class="box gradient">
          <div class="title">
            <h3><a href="{{ route('admin.accounts.materials') }}"  class="btn btn-mini pull-right" style="margin:5px 5px 0 0"><i class="fa fa-hand-o-left"></i> 返回</a>
            <i class="fa fa-share-alt"></i><span>修改文章</span>
            </h3>
          </div>
          <div class="content">

            {{ Form::open(array('route' => 'admin.accounts.materials_update','files'=>true,'class'=>'form-horizontal  row-fluid')) }}
                  <input type="hidden" name="id" value="{{ $material->id }}">
                  <div class="form-row control-group row-fluid">
                    <label class="control-label span3" for="text">文章标题</label>
                    <div class="controls span5">
                      <div class="input-prepend row-fluid">
                        <span class="add-on prepend "><i class="fa fa-wechat "></i></span>
                        <input class="row-fluid" value="{{ $material->title }}" name="title" id="cloth2" required  size="50" type="text" placeholder="分享文章标题">
                      </div>
                    </div>
                  </div>
                  <div class="form-row control-group row-fluid">
                    <label class="control-label span3" for="text">触发关键字</label>
                    <div class="controls span5">
                      <div class="input-prepend row-fluid">
                        <span class="add-on prepend "><i class="fa fa-wechat "></i></span>
                        <input class="row-fluid" value="{{ $material->key }}" name="key" id="cloth2"  size="50" type="text" placeholder="触发关键字">
                      </div>
                    </div>
                  </div>
                  <div class="form-row control-group row-fluid">
                    <label class="control-label span3" for="text">作者来源</label>
                    <div class="controls span5">
                      <div class="input-prepend row-fluid">
                        <span class="add-on prepend "><i class="fa fa-user "></i></span>
                        <input class="row-fluid" value="{{ $material->author }}" name="author" id="author"  size="50" type="text" placeholder="自定义作者或者文章来源（选填）">
                      </div>
                    </div>
                  </div>
                  <div class="form-row control-group row-fluid">
                    <label class="control-label span3" for="text">奖励积分</label>
                    <div class="controls span3">
                      <div class="input-prepend input-append row-fluid">
                        <span class="add-on prepend "><i class="icon-pengyouquan"></i></span>
                        <input class="row-fluid" value="{{ $material->points }}" name="points" id="price2"  size="6" type="text"  placeholder="不奖励请留空">
                        <span class="add-on "> 分 / </span>
                      </div>
                    </div>
                    <div class="controls span3">
                      <label class="inline radio">
                      <input type="radio" name="type" @if($material->type ==1) checked @endif value="1"/> 分享 </label>
                      <label class="inline radio">
                      <input type="radio" name="type" @if($material->type !=1) checked @endif value="2"/> 点击 </label>
                      <label class="inline radio">
                      <input type="radio" name="cart" @if($material->cart ==0) checked @endif value="0"/> 水知识 </label>
                      <label class="inline radio">
                      <input type="radio" name="cart" @if($material->cart ==1) checked @endif value="1"/> 水状况 </label>
                    </div>
                  </div>
                  <div class="form-row control-group row-fluid">
                    <label class="control-label span3" for="search-input">封面头图 <span class="help-block">建议尺寸：900像素 * 500像素</span></label>
                    <div class="controls span7">
                      <div class="input-append row-fluid">
                        <input type="file" name="cover" class="spa1n6 fileinput" id="search-input">
                      </div>
                    </div>
                  </div>

                  <div class="form-row control-group row-fluid">
                    <label class="control-label span3" for="text">文章摘要</label>
                    <div class="controls span5">
                      <textarea id="text" rows="3" name="dec" class="row-fluid">{{ $material->dec }}</textarea>
                      <div id="bottom">
                        <span id="chars">100</span> 字剩余
                      </div>
                    </div>
                  </div>
                  <div class="form-row control-group row-fluid">
                    <label class="control-label span3" for="editor1">文章内容
                    </label>
                    <div class="controls span5">
                        <script id="editor" type="text/plain" style="height:500px;">{{ $material->content }}</script>
                    </div>
                  </div>
                  <div class="form-row control-group row-fluid">
                    <label class="control-label span3" for="text">原文链接</label>
                    <div class="controls span5">
                      <div class="input-prepend row-fluid">
                        <span class="add-on prepend "><i class="fa fa-chain "></i></span>
                        <input class="row-fluid" name="url" id="link" value="{{ $material->url }}"  size="50" type="text" placeholder="选填">
                      </div>
                    </div>
                  </div>

                  <div class="form-actions row-fluid">
                    <div class="span10 offset3">
                      <button type="submit" class="btn btn-large btn-info"><i class="fa fa-save"></i> 立即保存</button>
                      <button type="button" class="btn btn-large"><i class="fa fa-hand-o-left"></i> 取消</button>
                    </div>
                  </div>
              {{ Form::close() }}


            </div>
        </div>
        <!-- End box -->
      </div>

@stop


@section('modals')

<div id="confirm_alert" class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-sm">
    <div class="modal-content">
      <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 class="modal-title" id="myModalLabel">确定本次操作吗？</h3>
      </div>
      <div class="modal-body">
        <i class=" icon-warning-sign color_red pull-left fs_24"></i>

        <p>一旦【确定】，本次操作不可撤销。</p>

      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
        <button type="button" class="btn btn-primary">确定</button>
      </div>
    </div>
  </div>
</div>
@stop


@section('script')
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/full-calendar/fullcalendar.min.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/jquery.peity.min.js') }}"></script>
<script type="text/javascript" language="javascript" src="{{ URL::asset('ad/js/plugins/datatables/js/jquery.dataTables.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/chosen/chosen/chosen.jquery.min.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/flot/jquery.flot.js') }}"></script>
<script language="javascript" type="text/javascript" src="{{ URL::asset('ad/js/plugins/jquery.uniform.min.js') }}"></script>
<script src="{{ URL::asset('ad/js/plugins/justGage.1.0.1/resources/js/raphael.2.1.0.min.js') }}"></script>
<script src="{{ URL::asset('ad/js/plugins/justGage.1.0.1/resources/js/justgage.1.0.1.min.js') }}"></script>
<script src="{{ URL::asset('ad/js/scripts.js') }}"></script>


    <script type="text/javascript" charset="utf-8">
    // Datatables
    $(document).ready(function() {
      var dontSort = [];
                $('#datatable_city thead th').each( function () {
                    if ( $(this).hasClass( 'no_sort' )) {
                        dontSort.push( { "bSortable": false } );
                    } else {
                        dontSort.push( null );
                    }
      } );
      $('#datatable_city').dataTable( {
        "sDom": "<'row table_top_bar'<'row-fluid'>'<'to_hide_phone'>'f'<'>r>t<'row'>",
         "sDom": "<'row table_top_bar'<'row-fluid'<'to_hide_phone' f>>><'row'>",
         "aaSorting": [[ 1, "asc" ]],
        "bPaginate": false,
        "bJQueryUI": false,
        "aoColumns": dontSort

      } );
      $.extend( $.fn.dataTableExt.oStdClasses, {
        "s`": "dataTables_wrapper form-inline"
      } );
    } );
    </script>
    <script type="text/javascript">

        //实例化编辑器
        //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
        var ue = UE.getEditor('editor');

    </script>
@stop
